/**
 *
 */
package net.haroeris.wh40kcampaign.beans.po;

import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author user
 *
 */
@Entity
@Table(name=Campaign.TABLE_NAME)
@NamedQueries({
    //@NamedQuery(name = Campaign.QUERY_FINDPLAYERS,  query = "SELECT p FROM Campaign c, Player p where c."),
    @NamedQuery(name = Campaign.QUERY_FINDALL,      query = "SELECT c FROM Campaign c")
})
public class Campaign {
    public static final String QUERY_FINDALL= "Campaign.findAll";
    public static final String QUERY_FINDPLAYERS= "Campaign.findPlayers";
    public static final String TABLE_NAME="campaign";

    @OneToMany
    private Collection<Party> parties;
    @Id
    @GeneratedValue
    private long id;
    /**Der Name der Kampagne*/
    private String name;
    /** Eine sprechende Beschreibung der Kampagne. */
    private String description;

    /**
     * @return the parties
     */
    public Collection<Party> getParties() {
        return parties;
    }
    /**
     * @param parties the parties to set
     */
    public void setParties(Collection<Party> parties) {
        this.parties = parties;
    }
    /**
     * @return the id
     */
    public long getId() {
        return id;
    }
    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }
    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }
    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString(){
        return "["+getClass().getSimpleName()+" id="+getId()+"; name="+getName()+"]";
    }
}